/**
 * Created by hama on 2016/6/21.
 */
module.exports = function (app) {
    //加载模板
    var template = require('art-template');
    //把模板的配置写一下
    app.engine('.html', template.__express);
    app.set('view engine', 'html');
    //模板的过滤器放在这里
    template.helper('ms', function (time) {
        var time = new Date(time);
        return time.getTime();
    })
    template.helper('formatTime', function (time) {
        var time = new Date(time);
        var year = time.getFullYear();
        var month = time.getMonth() + 1;
        var day = time.getDate();
        var month = month < 10 ? '0' + month : month;
        var day = day < 10 ? '0' + day : day;
        return `${year}
        -${month}-
        ${day}
        `;
    })
}